import {
	http
} from '@/utils/request/index.js'
// CRM 合同管理相关接口

// 查询 CRM 合同列表
export function getContractPage(params) {
	return http.get('/crm/contract/page', params)
}

// 查询 CRM 联系人列表，基于指定客户
export function getContractPageByCustomer(params) {
	return http.get('/crm/contract/page-by-customer', params)
}

// 查询 CRM 联系人列表，基于指定商机
export function getContractPageByBusiness(params) {
	return http.get('/crm/contract/page-by-business', params)
}

// 查询 CRM 合同详情
export function getContract(id) {
	return http.get('/crm/contract/get', { id })
}

// 查询 CRM 合同下拉列表
export function getContractSimpleList(customerId) {
	return http.get('/crm/contract/simple-list', { customerId })
}

// 新增 CRM 合同
export function createContract(data) {
	return http.post('/crm/contract/create', data)
}

// 修改 CRM 合同
export function updateContract(data) {
	return http.put('/crm/contract/update', data)
}

// 删除 CRM 合同
export function deleteContract(id) {
	return http.delete('/crm/contract/delete', { id })
}

// 导出 CRM 合同 Excel
export function exportContract(params) {
	return http.download('/crm/contract/export-excel', params)
}

// 提交审核
export function submitContract(id) {
	return http.put('/crm/contract/submit', { id })
}

// 合同转移
export function transferContract(data) {
	return http.put('/crm/contract/transfer', data)
}

// 获得待审核合同数量
export function getAuditContractCount() {
	return http.get('/crm/contract/audit-count')
}

// 获得即将到期（提醒）的合同数量
export function getRemindContractCount() {
	return http.get('/crm/contract/remind-count')
}